<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<link rel="stylesheet" media="screen" href="css/docs.css" />
<link rel="stylesheet" media="screen" href="lib/datatables/css/vpad.css" />

<!-- jQplot SETUP END -->
<h1 class="page-title">薪资架构管理-项目管理</h1>
<div class="container_12 clearfix leading">
	<form id="post_form" name="post_form">
		<s:if test="#request.structure != null && #request.structure.id > 0">
			<input type="hidden" name="structure.id" value="${structure.id}" />
		</s:if>
		<input type="hidden" name="structure.organization.id"
			value="${structure.organization.id}" />
		<div class="clear"></div>
		<h5>
			薪资方案：<strong><input id="title" name="structure.projectTitle"
				type="text" style="width: 30%" value="${structure.projectTitle}"></strong>
		</h5>
		<div class="portlet leading">
			<header>
				<h6 style="margin-bottom: 0px">
					<a href="javascript:void(0)"><span
						style="background: url(${ctx}/images/img/add.png)" class="icon">&nbsp;</span>补贴部分</a>
				</h6>
			</header>
			<s:if test="(#request.structure.details != null && #request.subsidyItemLength > 0) || #request.structure.details == null || #request.structure.details.size() == 0">
			<section class="tabs side">
				<ul class="clearfix" style="width: 150px"
					id="insdetail_tabs_subsidy">
					<s:if
						test="#request.structure.details != null && #request.structure.details.size() > 0">
						<s:iterator var="dt" status="st"
							value="#request.structure.details">
							<s:if
								test="#dt.structType != null && #dt.structType.toString().equals('subsidy')">
								<li style="width: 150px"><a href="javascript:void(0)"
									onclick="tabChangeEvent(this,'subsidy')"><span
										style="background: url(${ctx}/images/img/add.png)"
										class="icon">&nbsp;</span><span>${dt.schemeTitle}</span></a></li>
							</s:if>
						</s:iterator>
					</s:if>
					<s:else>
						<li style="width: 150px"><a
							onclick="tabChangeEvent(this,'subsidy')"
							href="javascript:void(0)" class="current"><span class="icon"
								style="background: url(${ctx}/images/img/add.png)">&nbsp;</span><span></span></a></li>
					</s:else>
				</ul>
				<section style="margin-left: 150px" id="insdetail_sections_subsidy">
					<s:if
						test="#request.structure.details != null && #request.structure.details.size() > 0">
						<s:iterator var="dt" status="st"
							value="#request.structure.details">
							<s:if test="#dt.structType.toString().equals('subsidy')">
								<section class="clearfix"
									<s:if test="#st.index == 0">style="display:block"</s:if>
									<s:else>style="display:none"</s:else>>
									<h6>
										项目名称：<strong><input name="schemeTitle_subsidy"
											type="text" style="width: 30%" value="${dt.schemeTitle}"></strong>
									</h6>
									<div class="portlet leading">
										<header>
											<h6 style="margin-bottom: 0px">
												设定项目：<a href="javascript:void(0)"></a>
											</h6>
										</header>

										<section>
											<table class="display" id="example" style="clear: none">
												<thead>
													<tr>
														<th>挂钩数据</th>
														<th>细项</th>
														<th>单位</th>
														<th>每单位补贴</th>
														<th>固定补贴</th>
													</tr>
												</thead>
												<tbody>
													<tr class="gradeA">
														<td><select style="opacity: 0;"
															name="linkedDataType_subsidy"
															onchange="linkedSelectChangeEvent(this,'subsidy')">						
																<option value="no_link" <s:if test="#dt.linkedDataType.toString().equals('no_link')">selected="selected"</s:if>>无挂钩数据</option>
																<option value="social_insurance" <s:if test="#dt.linkedDataType.toString().equals('social_insurance')">selected="selected"</s:if>>社保</option>
																<option value="individual_tax" <s:if test="#dt.linkedDataType.toString().equals('individual_tax')">selected="selected"</s:if>>个人所得税</option>
																<option value="overtime" <s:if test="#dt.linkedDataType.toString().equals('overtime')">selected="selected"</s:if>>加班费</option>
																<option value="performance" <s:if test="#dt.linkedDataType.toString().equals('performance')">selected="selected"</s:if>>绩效奖金</option>
																<option value="basic_salary" <s:if test="#dt.linkedDataType.toString().equals('basic_salary')">selected="selected"</s:if>>底薪</option>
																<option value="erp_data" <s:if test="#dt.linkedDataType.toString().equals('erp_data')">selected="selected"</s:if>>ERP数据源</option>
																<option value="examine" <s:if test="#dt.linkedDataType.toString().equals('examine')">selected="selected"</s:if>>考勤数据源</option>
														</select></td>
														<td><select name="linkedDataId_subsidy"
															style="opacity: 0;" onchange="linkedDataClick(this,'subsidy')">
																<option value="-1">无细项</option>
																<s:if test="#dt.linkedDataId > 0">
																	<option value="${dt.linkedDataId}" selected="selected">${dt.linkedDataTitle}</option>
																</s:if>
														</select><input type="hidden" name="linkedDataTitle_subsidy" value="${dt.linkedDataTitle}"/></td>
														<td>次数</td>
														<td><strong> <input name="unitCost_subsidy"
																type="text" style="width: 60px" value="${dt.unitCost}" />
																元
														</strong></td>
														<td><input name="fixedCost_subsidy" type="text"
															style="width: 60px" value="${dt.fixedCost}" /> 元</td>
													</tr>
												</tbody>
											</table>
										</section>
									</div>
									<div class="portlet leading">

										<header>
											<h6 style="margin-bottom: 0px">
												设定周期：<a href="javascript:void(0)"></a>
											</h6>
										</header>
										<section>
											<table class="full">
												<tbody>
													<tr>
														<td><input name="periodType_subsidy_${st.index}"
															type="radio" value="monthly" <s:if test="#dt.periodType.toString().equals('monthly')">checked="checked"</s:if> onclick="periodTypeClick(this,'subsidy')" /> 月度</td>
														<td><input name="periodType_subsidy_${st.index}"
															type="radio" value="bimonthly" <s:if test="#dt.periodType.toString().equals('bimonthly')">checked="checked"</s:if> onclick="periodTypeClick(this,'subsidy')"/> 双月</td>
														<td><input name="periodType_subsidy_${st.index}"
															type="radio" value="season" <s:if test="#dt.periodType.toString().equals('season')">checked="checked"</s:if> onclick="periodTypeClick(this,'subsidy')"/> 季度</td>
														<td><input name="periodType_subsidy_${st.index}"
															type="radio" value="semiyearly" <s:if test="#dt.periodType.toString().equals('semiyearly')">checked="checked"</s:if> onclick="periodTypeClick(this,'subsidy')"/> 半年</td>
														<td><input name="periodType_subsidy_${st.index}"
															type="radio" value="annually" <s:if test="#dt.periodType.toString().equals('annually')">checked="checked"</s:if> onclick="periodTypeClick(this,'subsidy')"/> 一年</td>
														<td class="ar" style="width: 25%"><input type="hidden" name="periodType_subsidy" value="${dt.periodType}"/></td>
													</tr>
												</tbody>
											</table>
										</section>
									</div>
									<div class="portlet leading">
										<header>
											<h6 style="margin-bottom: 0px">设定考核周期计算方式：</h6>
										</header>
										<section>
											<table class="full">
												<tbody>
													<tr>
														<td><input
															name="periodComputeMode_subsidy_${st.index}" type="radio"
															value="-1" onclick="periodComputeClick(this,'subsidy')" <s:if test="#dt.periodComputeMode < 0">checked="checked"</s:if>/> 自然月</td>
														<td><span class="ar" style="width: 25%"> <input
																name="periodComputeMode_subsidy_${st.index}"
																type="radio" value="2" onclick="periodComputeClick(this,'subsidy')" <s:if test="#dt.periodComputeMode > 0">checked="checked"</s:if>/> 周期起始日 <select
																name="periodComputeMode_subsidy_select_${st.index}" onchange="periodComputeSelectClick(this,'subsidy')">
																	<option value="2">2</option>
																	<option value="3">3</option>
																	<option value="4">4</option>
																	<option value="5">5</option>
																	<option value="6">6</option>
																	<option value="7">7</option>
																	<option value="8">8</option>
																	<option value="9">9</option>
																	<option value="10">10</option>
																	<option value="11">11</option>
																	<option value="12">12</option>
																	<option value="13">13</option>
																	<option value="14">14</option>
																	<option value="15">15</option>
																	<option value="16">16</option>
																	<option value="17">17</option>
																	<option value="18">18</option>
																	<option value="19">19</option>
																	<option value="20">20</option>
																	<option value="21">21</option>
																	<option value="22">22</option>
																	<option value="23">23</option>
																	<option value="24">24</option>
																	<option value="25">25</option>
																	<option value="26">26</option>
																	<option value="27">27</option>
																	<option value="28">28</option>
															</select>
														</span></td>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
														<td style="width: 25%" class="ar"><input type="hidden" name="periodComputeMode_subsidy" value="${dt.periodComputeMode}"/></td>
													</tr>
												</tbody>
											</table>
										</section>
									</div>
									<div class="tabs side grid_12 leading">
										<div class="clear"></div>
										<div class="grid_12">
											<div class="form-action clearfix">
												<p>
													<a name="modify" class="button" href="javascript:void(0)"
														onclick="modifyScheme(this,'subsidy')"><span
														style="background: url(${ctx}/images/img/page_edit.png)"
														class="icon">&nbsp;</span>修改</a> <a name="delete"
														class="button" href="javascript:void(0)"
														onclick="deleteScheme(this,'subsidy')"><span
														style="background: url(${ctx}/images/img/cancel.png)"
														class="icon">&nbsp;</span>删除</a>
												</p>
											</div>
										</div>
									</div>
								</section>
							</s:if>
						</s:iterator>
					</s:if>
					<s:else>
						<section class="clearfix">
							<h6>
								项目名称：<strong><input name="schemeTitle_subsidy"
									type="text" style="width: 30%" value=""></strong>
							</h6>
							<div class="portlet leading">
								<header>
									<h6 style="margin-bottom: 0px">
										设定项目：<a href="javascript:void(0)"></a>
									</h6>
								</header>

								<section>
									<table class="display" id="example" style="clear: none">
										<thead>
											<tr>
												<th>挂钩数据</th>
												<th>细项</th>
												<th>单位</th>
												<th>每单位补贴</th>
												<th>固定补贴</th>
											</tr>
										</thead>
										<tbody>
											<tr class="gradeA">
												<td><select style="opacity: 0;"
													name="linkedDataType_subsidy"
													onchange="linkedSelectChangeEvent(this,'subsidy')">
														<option value="no_link">无挂钩数据</option>
														<option value="social_insurance">社保</option>
														<option value="individual_tax">个人所得税</option>
														<option value="overtime">加班费</option>
														<option value="performance">绩效奖金</option>
														<option value="basic_salary">底薪</option>
														<option value="erp_data">ERP数据源</option>
														<option value="examine">考勤数据源</option>
												</select></td>
												<td><select name="linkedDataId_subsidy"
													style="opacity: 0;" onchange="linkedDataClick(this,'subsidy')">
														<option value="-1">无细项</option>
												</select><input type="hidden" name="linkedDataTitle_subsidy" value="无细项"/></td>
												<td>次数</td>
												<td><strong> <input name="unitCost_subsidy"
														type="text" style="width: 60px" value="" />
														元
												</strong></td>
												<td><input name="fixedCost_subsidy" type="text"
													style="width: 60px" value="" /> 元</td>
											</tr>
										</tbody>
									</table>
								</section>
							</div>
							<div class="portlet leading">

								<header>
									<h6 style="margin-bottom: 0px">
										设定周期：<a href="javascript:void(0)"></a>
									</h6>
								</header>
								<section>
									<table class="full">
										<tbody>
											<tr>
												<td><input name="periodType_subsidy_0"
															type="radio" value="monthly" checked="checked" onclick="periodTypeClick(this,'subsidy')" /> 月度</td>
												<td><input name="periodType_subsidy_0"
													type="radio" value="bimonthly" onclick="periodTypeClick(this,'subsidy')"/> 双月</td>
												<td><input name="periodType_subsidy_0"
													type="radio" value="season" onclick="periodTypeClick(this,'subsidy')"/> 季度</td>
												<td><input name="periodType_subsidy_0"
													type="radio" value="semiyearly" onclick="periodTypeClick(this,'subsidy')"/> 半年</td>
												<td><input name="periodType_subsidy_0"
													type="radio" value="annually" onclick="periodTypeClick(this,'subsidy')"/> 一年</td>
												<td class="ar" style="width: 25%"><input type="hidden" name="periodType_subsidy" value="monthly"/></td>
											</tr>
										</tbody>
									</table>
								</section>
							</div>
							<div class="portlet leading">
								<header>
									<h6 style="margin-bottom: 0px">设定考核周期计算方式：</h6>
								</header>
								<section>
									<table class="full">
										<tbody>
											<tr>
												<td><input name="periodComputeMode_subsidy_0"
													type="radio" value="-1" checked="checked" onclick="periodComputeClick(this,'subsidy')"/> 自然月</td>
												<td><span class="ar" style="width: 25%"> <input
														name="periodComputeMode_subsidy_0" type="radio"
														value="2" onclick="periodComputeClick(this,'subsidy')"/> 周期起始日 <select
														name="periodComputeMode_subsidy_select_0" onchange="periodComputeSelectClick(this,'subsidy')">
															<option value="2" <s:if test="#dt.periodComputeMode == 2">selected="selected"</s:if>>2</option>
															<option value="3" <s:if test="#dt.periodComputeMode == 3">selected="selected"</s:if>>3</option>
															<option value="4" <s:if test="#dt.periodComputeMode == 4">selected="selected"</s:if>>4</option>
															<option value="5" <s:if test="#dt.periodComputeMode == 5">selected="selected"</s:if>>5</option>
															<option value="6" <s:if test="#dt.periodComputeMode == 6">selected="selected"</s:if>>6</option>
															<option value="7" <s:if test="#dt.periodComputeMode == 7">selected="selected"</s:if>>7</option>
															<option value="8" <s:if test="#dt.periodComputeMode == 8">selected="selected"</s:if>>8</option>
															<option value="9" <s:if test="#dt.periodComputeMode == 9">selected="selected"</s:if>>9</option>
															<option value="10" <s:if test="#dt.periodComputeMode == 10">selected="selected"</s:if>>10</option>
															<option value="11" <s:if test="#dt.periodComputeMode == 11">selected="selected"</s:if>>11</option>
															<option value="12" <s:if test="#dt.periodComputeMode == 12">selected="selected"</s:if>>12</option>
															<option value="13" <s:if test="#dt.periodComputeMode == 13">selected="selected"</s:if>>13</option>
															<option value="14" <s:if test="#dt.periodComputeMode == 14">selected="selected"</s:if>>14</option>
															<option value="15" <s:if test="#dt.periodComputeMode == 15">selected="selected"</s:if>>15</option>
															<option value="16" <s:if test="#dt.periodComputeMode == 16">selected="selected"</s:if>>16</option>
															<option value="17" <s:if test="#dt.periodComputeMode == 17">selected="selected"</s:if>>17</option>
															<option value="18" <s:if test="#dt.periodComputeMode == 18">selected="selected"</s:if>>18</option>
															<option value="19" <s:if test="#dt.periodComputeMode == 19">selected="selected"</s:if>>19</option>
															<option value="20" <s:if test="#dt.periodComputeMode == 20">selected="selected"</s:if>>20</option>
															<option value="21" <s:if test="#dt.periodComputeMode == 21">selected="selected"</s:if>>21</option>
															<option value="22" <s:if test="#dt.periodComputeMode == 22">selected="selected"</s:if>>22</option>
															<option value="23" <s:if test="#dt.periodComputeMode == 23">selected="selected"</s:if>>23</option>
															<option value="24" <s:if test="#dt.periodComputeMode == 24">selected="selected"</s:if>>24</option>
															<option value="25" <s:if test="#dt.periodComputeMode == 25">selected="selected"</s:if>>25</option>
															<option value="26" <s:if test="#dt.periodComputeMode == 26">selected="selected"</s:if>>26</option>
															<option value="27" <s:if test="#dt.periodComputeMode == 27">selected="selected"</s:if>>27</option>
															<option value="28" <s:if test="#dt.periodComputeMode == 28">selected="selected"</s:if>>28</option>
													</select>
												</span></td>
												<td>&nbsp;</td>
												<td>&nbsp;</td>
												<td>&nbsp;</td>
												<td style="width: 25%" class="ar"><input type="hidden" name="periodComputeMode_subsidy" value="-1"/></td>
											</tr>
										</tbody>
									</table>
								</section>
							</div>
							<div class="tabs side grid_12 leading">
								<div class="clear"></div>
								<div class="grid_12">
									<div class="form-action clearfix">
										<p>
											<a name="modify" class="button" href="javascript:void(0)"
												onclick="modifyScheme(this,'subsidy')"><span
												style="background: url(${ctx}/images/img/page_edit.png)"
												class="icon">&nbsp;</span>提交</a> <a name="delete" class="button"
												href="javascript:void(0)"
												onclick="deleteScheme(this,'subsidy')"><span
												style="background: url(${ctx}/images/img/cancel.png)"
												class="icon">&nbsp;</span>删除</a>
										</p>
									</div>
								</div>
							</div>
						</section>
					</s:else>
				</section>
				<div class="clear"></div>
				<div class="container_12 clearfix leading"
					style="padding-left: 20px">
					<div class="form-action clearfix" style="margin-left: 115px">
						<p>
							<a class="button" href="javascript:void(0)"
								onclick="appendScheme('subsidy')"><span
								style="background: url(${ctx}/images/img/add.png)" class="icon">&nbsp;</span>添加项目</a>
						</p>
					</div>
				</div>
			</section>
			</s:if>
		</div>
		<div class="portlet leading">
			<header>
				<h6 style="margin-bottom: 0px">
					<a href="#" style="color: #F00"><span
						style="background: url(images/img/delete.png)" class="icon">&nbsp;</span>扣款部分</a>
				</h6>
			</header>

			<s:if test="(#request.structure.details != null && #request.detainItemLength > 0) || #request.structure.details == null || #request.structure.details.size() == 0">
			<section class="tabs side">


				<ul class="clearfix" style="width: 150px" id="insdetail_tabs_detain">
					<s:if
						test="#request.structure.details != null && #request.structure.details.size() > 0">
						<s:iterator var="dt" status="st"
							value="#request.structure.details">
							<s:if test="#dt.structType.toString().equals('detain')">
								<li style="width: 150px"><a href="javascript:void(0)"
									onclick="tabChangeEvent(this,'detain')"><span
										style="background: url(${ctx}/images/img/delete.png)"
										class="icon">&nbsp;</span><span>${dt.schemeTitle}</span></a></li>
							</s:if>
						</s:iterator>
					</s:if>
					<s:else>
						<li style="width: 150px"><a
							onclick="tabChangeEvent(this,'detain')" href="javascript:void(0)"
							class="current"><span class="icon"
								style="background: url(${ctx}/images/img/delete.png)">&nbsp;</span><span></span></a></li>
					</s:else>
				</ul>
				<section style="margin-left: 150px" id="insdetail_sections_detain">
					<s:if
						test="#request.structure.details != null && #request.structure.details.size() > 0">
						<s:iterator var="dt" status="st"
							value="#request.structure.details">
							<s:if test="#dt.structType.toString().equals('detain')">
								<section class="clearfix"
									<s:if test="#st.index == 0">style="display:block"</s:if>
									<s:else>style="display:none"</s:else>>
									<h6>
										项目名称：<strong><input name="schemeTitle_detain"
											type="text" style="width: 30%" value="${dt.schemeTitle}"></strong>
									</h6>
									<div class="portlet leading">
										<header>
											<h6 style="margin-bottom: 0px">
												设定项目：<a href="javascript:void(0)"></a>
											</h6>
										</header>

										<section>
											<table class="display" id="example" style="clear: none">
												<thead>
													<tr>
														<th>挂钩数据</th>
														<th>细项</th>
														<th>单位</th>
														<th>每单位补贴</th>
														<th>固定补贴</th>
													</tr>
												</thead>
												<tbody>
													<tr class="gradeX">
														<td><select style="opacity: 0;"
															name="linkedDataType_detain"
															onchange="linkedSelectChangeEvent(this,'detain')">						
																<option value="no_link" <s:if test="#dt.linkedDataType.toString().equals('no_link')">selected="selected"</s:if>>无挂钩数据</option>
																<option value="social_insurance" <s:if test="#dt.linkedDataType.toString().equals('social_insurance')">selected="selected"</s:if>>社保</option>
																<option value="individual_tax" <s:if test="#dt.linkedDataType.toString().equals('individual_tax')">selected="selected"</s:if>>个人所得税</option>
																<option value="overtime" <s:if test="#dt.linkedDataType.toString().equals('overtime')">selected="selected"</s:if>>加班费</option>
																<option value="performance" <s:if test="#dt.linkedDataType.toString().equals('performance')">selected="selected"</s:if>>绩效奖金</option>
																<option value="basic_salary" <s:if test="#dt.linkedDataType.toString().equals('basic_salary')">selected="selected"</s:if>>底薪</option>
																<option value="erp_data" <s:if test="#dt.linkedDataType.toString().equals('erp_data')">selected="selected"</s:if>>ERP数据源</option>
																<option value="examine" <s:if test="#dt.linkedDataType.toString().equals('examine')">selected="selected"</s:if>>考勤数据源</option>
														</select></td>
														<td><select name="linkedDataId_detain"
															style="opacity: 0;" onchange="linkedDataClick(this,'detain')">
																<option value="-1">无细项</option>
																<s:if test="#dt.linkedDataId > 0">
																	<option value="${dt.linkedDataId}" selected="selected">${dt.linkedDataTitle}</option>
																</s:if>
														</select><input type="hidden" name="linkedDataTitle_detain" value="${dt.linkedDataTitle}"/></td>
														<td>次数</td>
														<td><strong> <input name="unitCost_detain"
																type="text" style="width: 60px" value="${dt.unitCost}" />
																元
														</strong></td>
														<td><input name="fixedCost_detain" type="text"
															style="width: 60px" value="${dt.fixedCost}" /> 元</td>
													</tr>
												</tbody>
											</table>
										</section>
									</div>
									<div class="portlet leading">

										<header>
											<h6 style="margin-bottom: 0px">
												设定周期：<a href="javascript:void(0)"></a>
											</h6>
										</header>
										<section>
											<table class="full">
												<tbody>
													<tr>
														<td><input name="periodType_detain_${st.index}"
															type="radio" value="monthly" <s:if test="#dt.periodType.toString().equals('monthly')">checked="checked"</s:if> onclick="periodTypeClick(this,'detain')" /> 月度</td>
														<td><input name="periodType_detain_${st.index}"
															type="radio" value="bimonthly" <s:if test="#dt.periodType.toString().equals('bimonthly')">checked="checked"</s:if> onclick="periodTypeClick(this,'detain')"/> 双月</td>
														<td><input name="periodType_detain_${st.index}"
															type="radio" value="season" <s:if test="#dt.periodType.toString().equals('season')">checked="checked"</s:if> onclick="periodTypeClick(this,'detain')"/> 季度</td>
														<td><input name="periodType_detain_${st.index}"
															type="radio" value="semiyearly" <s:if test="#dt.periodType.toString().equals('semiyearly')">checked="checked"</s:if> onclick="periodTypeClick(this,'detain')"/> 半年</td>
														<td><input name="periodType_detain_${st.index}"
															type="radio" value="annually" <s:if test="#dt.periodType.toString().equals('annually')">checked="checked"</s:if> onclick="periodTypeClick(this,'detain')"/> 一年</td>
														<td class="ar" style="width: 25%"><input type="hidden" name="periodType_detain" value="${dt.periodType}"/></td>
													</tr>
												</tbody>
											</table>
										</section>
									</div>
									<div class="portlet leading">
										<header>
											<h6 style="margin-bottom: 0px">设定考核周期计算方式：</h6>
										</header>
										<section>
											<table class="full">
												<tbody>
													<tr>
														<td><input
															name="periodComputeMode_detain_${st.index}" type="radio"
															value="-1" onclick="periodComputeClick(this,'detain')" <s:if test="#dt.periodComputeMode < 0">checked="checked"</s:if>/> 自然月</td>
														<td><span class="ar" style="width: 25%"> <input
																name="periodComputeMode_detain_${st.index}"
																type="radio" value="2" onclick="periodComputeClick(this,'detain')" <s:if test="#dt.periodComputeMode > 0">checked="checked"</s:if>/> 周期起始日 <select
																name="periodComputeMode_detain_select_${st.index}" onchange="periodComputeSelectClick(this,'detain')">
																	<option value="2" <s:if test="#dt.periodComputeMode == 2">selected="selected"</s:if>>2</option>
																	<option value="3" <s:if test="#dt.periodComputeMode == 3">selected="selected"</s:if>>3</option>
																	<option value="4" <s:if test="#dt.periodComputeMode == 4">selected="selected"</s:if>>4</option>
																	<option value="5" <s:if test="#dt.periodComputeMode == 5">selected="selected"</s:if>>5</option>
																	<option value="6" <s:if test="#dt.periodComputeMode == 6">selected="selected"</s:if>>6</option>
																	<option value="7" <s:if test="#dt.periodComputeMode == 7">selected="selected"</s:if>>7</option>
																	<option value="8" <s:if test="#dt.periodComputeMode == 8">selected="selected"</s:if>>8</option>
																	<option value="9" <s:if test="#dt.periodComputeMode == 9">selected="selected"</s:if>>9</option>
																	<option value="10" <s:if test="#dt.periodComputeMode == 10">selected="selected"</s:if>>10</option>
																	<option value="11" <s:if test="#dt.periodComputeMode == 11">selected="selected"</s:if>>11</option>
																	<option value="12" <s:if test="#dt.periodComputeMode == 12">selected="selected"</s:if>>12</option>
																	<option value="13" <s:if test="#dt.periodComputeMode == 13">selected="selected"</s:if>>13</option>
																	<option value="14" <s:if test="#dt.periodComputeMode == 14">selected="selected"</s:if>>14</option>
																	<option value="15" <s:if test="#dt.periodComputeMode == 15">selected="selected"</s:if>>15</option>
																	<option value="16" <s:if test="#dt.periodComputeMode == 16">selected="selected"</s:if>>16</option>
																	<option value="17" <s:if test="#dt.periodComputeMode == 17">selected="selected"</s:if>>17</option>
																	<option value="18" <s:if test="#dt.periodComputeMode == 18">selected="selected"</s:if>>18</option>
																	<option value="19" <s:if test="#dt.periodComputeMode == 19">selected="selected"</s:if>>19</option>
																	<option value="20" <s:if test="#dt.periodComputeMode == 20">selected="selected"</s:if>>20</option>
																	<option value="21" <s:if test="#dt.periodComputeMode == 21">selected="selected"</s:if>>21</option>
																	<option value="22" <s:if test="#dt.periodComputeMode == 22">selected="selected"</s:if>>22</option>
																	<option value="23" <s:if test="#dt.periodComputeMode == 23">selected="selected"</s:if>>23</option>
																	<option value="24" <s:if test="#dt.periodComputeMode == 24">selected="selected"</s:if>>24</option>
																	<option value="25" <s:if test="#dt.periodComputeMode == 25">selected="selected"</s:if>>25</option>
																	<option value="26" <s:if test="#dt.periodComputeMode == 26">selected="selected"</s:if>>26</option>
																	<option value="27" <s:if test="#dt.periodComputeMode == 27">selected="selected"</s:if>>27</option>
																	<option value="28" <s:if test="#dt.periodComputeMode == 28">selected="selected"</s:if>>28</option>
															</select>
														</span></td>	
														<td>&nbsp;</td>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
														<td style="width: 25%" class="ar"><input type="hidden" name="periodComputeMode_detain" value="${dt.periodComputeMode}"/></td>
													</tr>
												</tbody>
											</table>
										</section>
									</div>
									<div class="tabs side grid_12 leading">
										<div class="clear"></div>
										<div class="grid_12">
											<div class="form-action clearfix">
												<p>
													<a name="modify" class="button" href="javascript:void(0)"
														onclick="modifyScheme(this,'detain')"><span
														style="background: url(${ctx}/images/img/page_edit.png)"
														class="icon">&nbsp;</span>修改</a> <a name="delete"
														class="button" href="javascript:void(0)"
														onclick="deleteScheme(this,'detain')"><span
														style="background: url(${ctx}/images/img/cancel.png)"
														class="icon">&nbsp;</span>删除</a>
												</p>
											</div>
										</div>
									</div>
								</section>
							</s:if>
						</s:iterator>
					</s:if>
					<s:else>
						<section class="clearfix">
							<h6>
								项目名称：<strong><input name="schemeTitle_detain"
									type="text" style="width: 30%" value=""></strong>
							</h6>
							<div class="portlet leading">
								<header>
									<h6 style="margin-bottom: 0px">
										设定项目：<a href="javascript:void(0)"></a>
									</h6>
								</header>

								<section>
									<table class="display" id="example" style="clear: none">
										<thead>
											<tr>
												<th>挂钩数据</th>
												<th>细项</th>
												<th>单位</th>
												<th>每单位补贴</th>
												<th>固定补贴</th>
											</tr>
										</thead>
										<tbody>
											<tr class="gradeX">
												<td><select style="opacity: 0;"
													name="linkedDataType_detain"
													onchange="linkedSelectChangeEvent(this,'detain')">
														<option value="no_link">无挂钩数据</option>
														<option value="social_insurance">社保</option>
														<option value="individual_tax">个人所得税</option>
														<option value="overtime">加班费</option>
														<option value="performance">绩效奖金</option>
														<option value="basic_salary">底薪</option>
														<option value="erp_data">ERP数据源</option>
														<option value="examine">考勤数据源</option>
												</select></td>
												<td><select name="linkedDataId_detain"
													style="opacity: 0;" onchange="linkedDataClick(this,'detain')">
														<option value="-1">无细项</option>
												</select><input type="hidden" name="linkedDataTitle_detain" value="无细项"/></td>
												<td>次数</td>
												<td><strong> <input name="unitCost_detain"
														type="text" style="width: 60px" value="" />
														元
												</strong></td>
												<td><input name="fixedCost_detain" type="text"
													style="width: 60px" value="" /> 元</td>
											</tr>
										</tbody>
									</table>
								</section>
							</div>
							<div class="portlet leading">

								<header>
									<h6 style="margin-bottom: 0px">
										设定周期：<a href="javascript:void(0)"></a>
									</h6>
								</header>
								<section>
									<table class="full">
										<tbody>
											<tr>
												<td><input name="periodType_detain_0"
															type="radio" value="monthly" checked="checked" onclick="periodTypeClick(this,'detain')" /> 月度</td>
												<td><input name="periodType_detain_0"
													type="radio" value="bimonthly" onclick="periodTypeClick(this,'detain')"/> 双月</td>
												<td><input name="periodType_detain_0"
													type="radio" value="season" onclick="periodTypeClick(this,'detain')"/> 季度</td>
												<td><input name="periodType_detain_0"
													type="radio" value="semiyearly" onclick="periodTypeClick(this,'detain')"/> 半年</td>
												<td><input name="periodType_detain_0"
													type="radio" value="annually" onclick="periodTypeClick(this,'detain')"/> 一年</td>
												<td class="ar" style="width: 25%"><input type="hidden" name="periodType_detain" value="monthly"/></td>
											</tr>
										</tbody>
									</table>
								</section>
							</div>
							<div class="portlet leading">
								<header>
									<h6 style="margin-bottom: 0px">设定考核周期计算方式：</h6>
								</header>
								<section>
									<table class="full">
										<tbody>
											<tr>
												<td><input name="periodComputeMode_detain_0"
													type="radio" value="-1" checked="checked" onclick="periodComputeClick(this,'detain')"/> 自然月</td>
												<td><span class="ar" style="width: 25%"> <input
														name="periodComputeMode_detain_0" type="radio"
														value="2" onclick="periodComputeClick(this,'detain')"/> 周期起始日 <select
														name="periodComputeMode_detain_select_0" onchange="periodComputeSelectClick(this,'detain')">
															<option value="2">2</option>
															<option value="3">3</option>
															<option value="4">4</option>
															<option value="5">5</option>
															<option value="6">6</option>
															<option value="7">7</option>
															<option value="8">8</option>
															<option value="9">9</option>
															<option value="10">10</option>
															<option value="11">11</option>
															<option value="12">12</option>
															<option value="13">13</option>
															<option value="14">14</option>
															<option value="15">15</option>
															<option value="16">16</option>
															<option value="17">17</option>
															<option value="18">18</option>
															<option value="19">19</option>
															<option value="20">20</option>
															<option value="21">21</option>
															<option value="22">22</option>
															<option value="23">23</option>
															<option value="24">24</option>
															<option value="25">25</option>
															<option value="26">26</option>
															<option value="27">27</option>
															<option value="28">28</option>
													</select>
												</span></td>
												<td>&nbsp;</td>
												<td>&nbsp;</td>
												<td>&nbsp;</td>
												<td style="width: 25%" class="ar"><input type="hidden" name="periodComputeMode_detain" value="-1"/></td>
											</tr>
										</tbody>
									</table>
								</section>
							</div>
							<div class="tabs side grid_12 leading">
								<div class="clear"></div>
								<div class="grid_12">
									<div class="form-action clearfix">
										<p>
											<a name="modify" class="button" href="javascript:void(0)"
												onclick="modifyScheme(this,'detain')"><span
												style="background: url(${ctx}/images/img/page_edit.png)"
												class="icon">&nbsp;</span>提交</a> <a name="delete" class="button"
												href="javascript:void(0)"
												onclick="deleteScheme(this,'detain')"><span
												style="background: url(${ctx}/images/img/cancel.png)"
												class="icon">&nbsp;</span>删除</a>
										</p>
									</div>
								</div>
							</div>
						</section>
					</s:else>
				</section>
				<div class="clear"></div>
				<div class="container_12 clearfix leading"
					style="padding-left: 20px">
					<div class="form-action clearfix" style="margin-left: 115px">
						<p>
							<a class="button" href="javascript:void(0)"
								onclick="appendScheme('detain')"><span
								style="background: url(${ctx}/images/img/add.png)" class="icon">&nbsp;</span>添加项目</a>
						</p>
					</div>

				</div>

			</section>
			</s:if>
		</div>
		<div class="clear"></div>
		<div class="tabs side grid_12 leading">

			<div class="clear"></div>
		</div>
	</form>
</div>

<div class="clear"></div>
<div class="container_12 clearfix leading" style="padding-left: 20px">


	<div class="form-action clearfix">
		<p>
			<a class="button" href="javascript:void(0)" onclick="checkForm()"><span
				style="background: url(${ctx}/images/img/page_edit.png)"
				class="icon">&nbsp;</span>确定提交</a> <a class="button"
				href="#salary/struct_main.xhtml?organizationId=${structure.organization.id}"><span
				style="background: url(${ctx}/images/img/arrow_undo.png)"
				class="icon">&nbsp;</span>返回</a>
		</p>
	</div>

</div>

<script type="text/javascript" src="${ctx}/js/global_util.js"></script>
<script type="text/javascript">
	/**
	 * 添加项目模块
	 */
	function appendScheme(mod) {
		//remove the current activity div
		$("#insdetail_tabs_" + mod).find("a").removeClass("current");
		$("#insdetail_sections_" + mod + ">section").attr("style",
				"display:none");
		var indexName = new Date().getTime();
		var tabHTML = "<li style=\"width: 150px\"><a class=\"current\" href=\"javascript:void(0)\" onclick=\"tabChangeEvent(this,'"
				+ mod
				+ "')\"><span style=\"background: url(${ctx}/images/img/" + (mod == "subsidy" ? "add" : "delete") + ".png)\" class=\"icon\">&nbsp;</span><span></span></a></li>";
		var sectionHTML = "<section class=\"clearfix\">";
		sectionHTML += "	<h6>";
		sectionHTML += "		项目名称：<strong><input name=\"schemeTitle_" + mod + "\" type=\"text\" style=\"width: 30%\" value=\"\"></strong>";
		sectionHTML += "	</h6>";
		sectionHTML += "	<div class=\"portlet leading\">";
		sectionHTML += "		<header>";
		sectionHTML += "			<h6 style=\"margin-bottom: 0px\">设定项目：<a href=\"javascript:void(0)\"></a></h6>";
		sectionHTML += "		</header>";
		sectionHTML += "		<section>";
		sectionHTML += "			<table class=\"display\" id=\"example\" style=\"clear: none\">";
		sectionHTML += "				<thead>";
		sectionHTML += "					<tr>";
		sectionHTML += "						<th>挂钩数据</th>";
		sectionHTML += "						<th>细项</th>";
		sectionHTML += "						<th>单位</th>";
		sectionHTML += "						<th>每单位补贴</th>";
		sectionHTML += "						<th>固定补贴</th>";
		sectionHTML += "					</tr>";
		sectionHTML += "				</thead>";
		sectionHTML += "				<tbody>";
		if(mod == "subsidy"){
			sectionHTML += "					<tr class=\"gradeA\">";
		}else{
			sectionHTML += "					<tr class=\"gradeX\">";
		}
		sectionHTML += "						<td>";
		sectionHTML +="							<select name=\"linkedDataType_" + mod + "\" onchange=\"linkedSelectChangeEvent(this,'" + mod + "')\">";
		sectionHTML += "							<option value=\"no_link\">无挂钩数据</option>";
		var optionArray = new Array();
		optionArray.push("<option value=\"social_insurance\">社保</option>");
		optionArray.push("<option value=\"individual_tax\">个人所得税</option>");
		optionArray.push("<option value=\"overtime\">加班费</option>");
		optionArray.push("<option value=\"performance\">绩效奖金</option>");
		optionArray.push("<option value=\"basic_salary\">底薪</option>");
		optionArray.push("<option value=\"erp_data\">ERP数据源</option>");
		optionArray.push("<option value=\"examine\">考勤数据源</option>");
		$("select[name='linkedDataType_" + mod + "']").each(function(i){
			for(var i=0;i<optionArray.length;i++){
				if(optionArray[i].indexOf(this.value) >= 0 && (this.value == "social_insurance" || this.value == "individual_tax" 
						|| this.value == "overtime" || this.value == "performance" || this.value == "basic_salary")){
					optionArray.splice(i,1);
				}
			}
		});
		for(var i=0;i<optionArray.length;i++){
			sectionHTML += optionArray[i];
		}
		sectionHTML += "						</select></td>";
		sectionHTML += "						<td><select name=\"linkedDataId_" + mod + "\" onchange=\"linkedDataClick(this,'" + mod + "')\">";
		sectionHTML += "							<option value=\"-1\">无细项</option>";
		sectionHTML += "						</select><input type=\"hidden\" name=\"linkedDataTitle_" + mod + "\" value=\"无细项\"/></td>";
		sectionHTML += "						<td>次数</td>";
		sectionHTML += "						<td><strong> <input name=\"unitCost_" + mod + "\" type=\"text\" style=\"width: 60px\" value=\"\" />元</strong></td>";
		sectionHTML += "						<td><input name=\"fixedCost_" + mod + "\" type=\"text\" style=\"width: 60px\" value=\"\" /> 元</td>";
		sectionHTML += "					</tr>";
		sectionHTML += "				</tbody>";
		sectionHTML += "			</table>";
		sectionHTML += "		</section>";
		sectionHTML += "	</div>";
		sectionHTML += "	<div class=\"portlet leading\">";
		sectionHTML += "		<header>";
		sectionHTML += "			<h6 style=\"margin-bottom: 0px\">设定周期：<a href=\"javascript:void(0)\"></a></h6>";
		sectionHTML += "		</header>";
		sectionHTML += "		<section>";
		sectionHTML += "			<table class=\"full\">";
		sectionHTML += "				<tbody>";
		sectionHTML += "					<tr>";
		sectionHTML += "						<td><input name=\"periodType_" + mod + "_" + indexName + "\" type=\"radio\" value=\"monthly\" checked=\"checked\" onclick=\"periodTypeClick(this,'" + mod + "')\" /> 月度</td>";
		sectionHTML += "						<td><input name=\"periodType_" + mod + "_" + indexName + "\" type=\"radio\" value=\"bimonthly\" onclick=\"periodTypeClick(this,'" + mod + "')\" /> 双月</td>";
		sectionHTML += "						<td><input name=\"periodType_" + mod + "_" + indexName + "\" type=\"radio\" value=\"season\" onclick=\"periodTypeClick(this,'" + mod + "')\" /> 季度</td>";
		sectionHTML += "						<td><input name=\"periodType_" + mod + "_" + indexName + "\" type=\"radio\" value=\"semiyearly\" onclick=\"periodTypeClick(this,'" + mod + "')\" /> 半年</td>";
		sectionHTML += "						<td><input name=\"periodType_" + mod + "_" + indexName + "\" type=\"radio\" value=\"annually\" onclick=\"periodTypeClick(this,'" + mod + "')\" /> 一年</td>";
		sectionHTML += "						<td class=\"ar\" style=\"width: 25%\"><input type=\"hidden\" name=\"periodType_" + mod + "\" value=\"monthly\"/></td>";
		sectionHTML += "					</tr>";
		sectionHTML += "				</tbody>";
		sectionHTML += "			</table>";
		sectionHTML += "		</section>";
		sectionHTML += "	</div>";
		sectionHTML += "	<div class=\"portlet leading\">";
		sectionHTML += "		<header>";
		sectionHTML += "			<h6 style=\"margin-bottom: 0px\">设定考核周期计算方式：</h6>";
		sectionHTML += "		</header>";
		sectionHTML += "		<section>";
		sectionHTML += "			<table class=\"full\">";
		sectionHTML += "				<tbody>";
		sectionHTML += "					<tr>";
		sectionHTML += "						<td><input name=\"periodComputeMode_" + mod + "_" + indexName + "\" type=\"radio\" value=\"-1\" checked=\"checked\" onclick=\"periodComputeClick(this,'" + mod + "')\" /> 自然月</td>";
		sectionHTML += "						<td><span class=\"ar\" style=\"width: 25%\"> <input name=\"periodComputeMode_" + mod + "_" + indexName + "\" type=\"radio\" value=\"2\" onclick=\"periodComputeClick(this,'" + mod + "')\" /> 周期起始日 <select name=\"periodComputeMode_" + mod + "_" + indexName + "\" onchange=\"periodComputeSelectClick(this,'" + mod + "')\" >";
		sectionHTML += "							<option value=\"2\">2</option>";
		sectionHTML += "							<option value=\"3\">3</option>";
		sectionHTML += "							<option value=\"4\">4</option>";
		sectionHTML += "							<option value=\"5\">5</option>";
		sectionHTML += "							<option value=\"6\">6</option>";
		sectionHTML += "							<option value=\"7\">7</option>";
		sectionHTML += "							<option value=\"8\">8</option>";
		sectionHTML += "							<option value=\"9\">9</option>";
		sectionHTML += "							<option value=\"10\">10</option>";
		sectionHTML += "							<option value=\"11\">11</option>";
		sectionHTML += "							<option value=\"12\">12</option>";
		sectionHTML += "							<option value=\"13\">13</option>";
		sectionHTML += "							<option value=\"14\">14</option>";
		sectionHTML += "							<option value=\"15\">15</option>";
		sectionHTML += "							<option value=\"16\">16</option>";
		sectionHTML += "							<option value=\"17\">17</option>";
		sectionHTML += "							<option value=\"18\">18</option>";
		sectionHTML += "							<option value=\"19\">19</option>";
		sectionHTML += "							<option value=\"20\">20</option>";
		sectionHTML += "							<option value=\"21\">21</option>";
		sectionHTML += "							<option value=\"22\">22</option>";
		sectionHTML += "							<option value=\"23\">23</option>";
		sectionHTML += "							<option value=\"24\">24</option>";
		sectionHTML += "							<option value=\"25\">25</option>";
		sectionHTML += "							<option value=\"26\">26</option>";
		sectionHTML += "							<option value=\"27\">27</option>";
		sectionHTML += "							<option value=\"28\">28</option>";
		sectionHTML += "						</select></span></td>";
		sectionHTML += "						<td>&nbsp;</td>";
		sectionHTML += "						<td>&nbsp;</td>";
		sectionHTML += "						<td>&nbsp;</td>";
		sectionHTML += "						<td style=\"width: 25%\" class=\"ar\"><input type=\"hidden\" name=\"periodComputeMode_" + mod + "\" value=\"-1\"/></td>";
		sectionHTML += "					</tr>";
		sectionHTML += "				</tbody>";
		sectionHTML += "			</table>";
		sectionHTML += "		</section>";
		sectionHTML += "	</div>";
		sectionHTML += "	<div class=\"tabs side grid_12 leading\">";
		sectionHTML += "		<div class=\"clear\"></div>";
		sectionHTML += "		<div class=\"grid_12\">";
		sectionHTML += "			<div class=\"form-action clearfix\">";
		sectionHTML += "				<p>";
		sectionHTML += "					<a name=\"modify\" class=\"button\" href=\"javascript:void(0)\"";
		sectionHTML += "						onclick=\"modifyScheme(this,'" + mod + "')\"><span";
		sectionHTML += "						style=\"background: url(${ctx}/images/img/page_edit.png)\"";
		sectionHTML += "						class=\"icon\">&nbsp;</span>提交</a> <a name=\"delete\" class=\"button\"";
		sectionHTML += "						href=\"javascript:void(0)\"";
		sectionHTML += "						onclick=\"deleteScheme(this,'" + mod + "')\"><span";
		sectionHTML += "						style=\"background: url(${ctx}/images/img/cancel.png)\"";
		sectionHTML += "						class=\"icon\">&nbsp;</span>删除</a>";
		sectionHTML += "				</p>";
		sectionHTML += "			</div>";
		sectionHTML += "		</div>";
		sectionHTML += "	</div>";
		sectionHTML += "</section>";
		
		$("#insdetail_tabs_" + mod).append(tabHTML);
		$("#insdetail_sections_" + mod).append(sectionHTML);
	}

	/**
	 * ul li item to click.
	 */
	function tabChangeEvent(clkObj, mod) {
		var ci = 0;
		$("#insdetail_tabs_" + mod).find("a").removeClass("current");
		$("#insdetail_sections_" + mod + ">section").attr("style",
				"display:none");
		$("#insdetail_tabs_" + mod).find("a").each(function(i) {
			if (this == clkObj) {
				$(this).addClass("current");
				ci = i;
			}
		});
		$("#insdetail_sections_" + mod + ">section").each(function(i) {
			if (ci == i) {
				$(this).attr("style", "display:block");
			}
		});
	}

	function focusTabCallBack(ci, mod) {
		$("#insdetail_tabs_" + mod).find("a").removeClass("current");
		$("#insdetail_sections_" + mod + ">section").attr("style",
				"display:none");
		$("#insdetail_tabs_" + mod).find("a").each(function(i) {
			if (ci == i) {
				$(this).addClass("current");
			}
		});
		$("#insdetail_sections_" + mod + ">section").each(function(i) {
			if (ci == i) {
				$(this).attr("style", "display:block");
			}
		});
	}

	/**
	 *	段落确定修改
	 */
	function modifyScheme(clkObj, mod) {
		var ci = 0;
		var mvalue = "";
		$("#insdetail_sections_" + mod).find("a[name='modify']").each(
				function(i) {
					if (this == clkObj) {
						ci = i;
					}
				});
		$("#insdetail_sections_" + mod + ">section")
				.each(
						function(i) {
							if (ci == i) {
								mvalue = $(this).find(
										"input[name='schemeTitle_" + mod
												+ "']").val();
							}
						});
		$("#insdetail_tabs_" + mod).find("a").each(function(i) {
			if (ci == i) {
				$(this).find("span:last").html(mvalue);
			}
		});
		if(mvalue != ""){
			$(clkObj).html("<span class=\"icon\" style=\"background: url(${ctx}/images/img/page_edit.png)\">&nbsp;</span>修改");
		}
	}

	/**
	 * 删除段落
	 */
	function deleteScheme(clkObj, mod) {
		if (confirm("确定要删除吗？")) {
			var ci = 0;
			$("#insdetail_sections_" + mod).find("a[name='delete']").each(
					function(i) {
						if (this == clkObj) {
							ci = i;
						}
					});
			$("#insdetail_sections_" + mod + ">section").each(function(i) {
				if (ci == i) {
					$(this).remove();
				}
			});
			$("#insdetail_tabs_" + mod).find("li").each(function(i) {
				if (ci == i) {
					$(this).remove();
				}
			});
			$("#insdetail_sections_" + mod + ">section:last").attr("style",
					"display:block");
			$("#insdetail_tabs_" + mod + " a:last").addClass("current");
		}
	}
	
	/**
	 * 挂勾数据修改
	 */
	function linkedSelectChangeEvent(obj,mod){
        var linkedDataIdObj = $(obj).parent().parent().parent().find("select[name='linkedDataId_" + mod + "']");
        $(linkedDataIdObj).find("option").remove();
		$.ajax({
	        type:"get",
	        url:"/ajax/salary_linkeddata_list.xhtml?organizationId=${structure.organization.id}&linkedDataType=" + obj.value,
	        //data: "name=John&location=Boston",
	        dataType:"json",
	        success:function (data) {
	    		var strLinkedDataHTML = "<option value=\"-1\">无细项</option>";
        		 if (data != null && data.length > 0) {
                     $.each(data, function (i, linked) {
                    	 strLinkedDataHTML += "<option value=\"" + linked.id + "\">" + linked.title + "</option>";
                     });
        		 }
                 $(linkedDataIdObj).append(strLinkedDataHTML);
	        }
	    });
		
		var linkedDataTitleObj = $(obj).parent().parent().parent().find("input[name='linkedDataTitle_" + mod + "']");
		$(linkedDataTitleObj).val("无细项");
	}
	
	function linkedDataClick(obj,mod){
		var linkedDataTitleObj = $(obj).parent().parent().parent().find("input[name='linkedDataTitle_" + mod + "']");
		var selectTitle = $(obj).parent().parent().parent().find("select[name='linkedDataId_" + mod+"']").find("option:selected").text();
		$(linkedDataTitleObj).val(selectTitle);
	}
	/**
	 * 周期改变
	 */
	function periodTypeClick(obj,mod){
		var periodTypeObj = $(obj).parent().parent().parent().parent().find("input[name='periodType_" + mod + "']");
		$(periodTypeObj).val(obj.value);
	}
	
	/**
	  * 计算方式改变
	  */
	function periodComputeClick(obj,mod){
		var periodComputeObj = $(obj).parent().parent().parent().parent().parent().find("input[name='periodComputeMode_" + mod + "']");
		$(periodComputeObj).val(obj.value);
	}
	/** 
	  * 计算方式选择点
	  */
	function periodComputeSelectClick(obj,mod){

		$(obj).parent().parent().parent().parent().parent().find("input:radio").attr("checked","");
		$(obj).parent().parent().parent().parent().parent().find("span.checked").removeClass();
		$(obj).parent().parent().parent().parent().parent().find("input:radio:last").attr("checked","checked");
		$(obj).parent().parent().parent().parent().parent().find("input:radio:last").parent().addClass("checked");
		var periodComputeObj = $(obj).parent().parent().parent().parent().parent().find("input[name='periodComputeMode_" + mod + "']");
		$(periodComputeObj).val(obj.value);
	}

	function checkForm() {
		if (checkNull($("#title").attr("value"))) {
			alert("方案名称不能空");
			$("#title").focus();
			return false;
		}
		
		var checkScheme = true;
		//检测补贴项目组 
		$("input[name='schemeTitle_subsidy']").each(function(i) {
			if (checkNull($(this).val())) {
				alert("补贴部分项目名称不能为空");
				$(this).focus();
				focusTabCallBack(i, "subsidy");
				checkScheme = false;
			}
		});
		if (!checkScheme) {
			return false;
		}
		$("input[name='unitCost_subsidy']").each(function(i) {
			if (isNaN($(this).val())) {
				alert("每单位补贴只能为数字");
				$(this).val("");
				$(this).focus();
				focusTabCallBack(i, "subsidy");
				checkScheme = false;
			}
		});
		if (!checkScheme) {
			return false;
		}
		$("input[name='fixedCost_subsidy']").each(function(i) {
			if (isNaN($(this).val())) {
				alert("固定补贴只能为数字");
				$(this).val("");
				$(this).focus();
				focusTabCallBack(i, "subsidy");
				checkScheme = false;
			}
		});
		if (!checkScheme) {
			return false;
		}
		//检测补贴项目组结束 
		$("input[name='schemeTitle_detain']").each(function(i) {
			if (checkNull($(this).val())) {
				alert("扣款部分项目名称不能为空");
				$(this).focus();
				focusTabCallBack(i, "detain");
				checkScheme = false;
			}
		});
		if (!checkScheme) {
			return false;
		}
		
		$("input[name='unitCost_detain']").each(function(i) {
			if (isNaN($(this).val())) {
				alert("每单位扣款只能为数字");
				$(this).val("");
				$(this).focus();
				focusTabCallBack(i, "detain");
				checkScheme = false;
			}
		});
		if (!checkScheme) {
			return false;
		}
		$("input[name='fixedCost_detain']").each(function(i) {
			if (isNaN($(this).val())) {
				alert("固定扣款只能为数字");
				$(this).val("");
				$(this).focus();
				focusTabCallBack(i, "detain");
				checkScheme = false;
			}
		});
		if (!checkScheme) {
			return false;
		}

		//提交数据 
		var url = "${ctx}/salary/post_structure.xhtml";
		$
				.ajax(
						url,
						{
							type : "POST",
							data : $("#post_form").serialize(),
							dataType : "html",
							cache : false,
							success : function(a) {
								alert("提交成功");
								window.location.href = "${ctx}/index.xhtml#salary/struct_main.xhtml?organizationId=${structure.organization.id}";
							},
							error : function(XMLHttpRequest, textStatus,
									errorThrown) {
								alert('提交申请发生异常');
							},
							complete : function() {
							}
						});
	}

	
</script>